<template>
  <el-pagination class="im-page"
                 :pager-count="pageCount"
                 :current-page="page"
                 :page-size="pageSize"
                 :small="false"
                 :total="total"
                 popper-class="im-page-item"
                 :page-sizes="pageSizes"
                 layout="sizes,prev,pager,next, total"
                 @size-change="handlePageSizeChange"
                 @current-change="handlePageChange">

  </el-pagination>
</template>

<script>
export default {
  name: "index",
  data() {
    return {
      pageSizes: [10, 20, 30,40, 50],
      test: {
        small: false,
        background: false,
        pageSize: 10,
        total: 1000
      }
    }
  },
  props: {
    page: {
      type: Number,
      default: 0
    },
    total: {
      type: Number,
      default: 0
    },
    pageCount: {
      type: Number,
      default: 5
    },
    pageSize: {
      type: Number,
      default: 20
    }
  },
  methods: {
    handlePageSizeChange(size) {
      this.$emit('on-page-size-change', size)
    },
    handlePageChange(val){
      this.$emit('on-page-change', val)
    }
  }
}
</script>

<style lang="scss">
.im-page{
  & > ul.el-pager{
    & > li{
      min-width: 28px;
      &.btn-quickprev{
        border-radius: 4px;
        margin-right: 5px;
      }
      &.btn-quicknext{
        border-radius: 4px;
        margin-right: 5px;
      }
    }
    & > li.active:not(.disabled){
      background-color: #FFEE61 !important;
      color: #222;
      font-weight: bold;
      border: none;
    }
    & > li.number{
      background: #fff !important;
      color: #888;
      border: 1px solid #DCDFE6;
      border-radius: 4px;
      min-width: 28px;
      &:not(:last-child){
        margin-right: 5px;
      }
      padding: 0;
      font-size: 12px;
    }
  }
  & > .btn-prev{
    margin-right: 5px;
    padding-right: 0;
    width: 28px;
    text-align: center;
    min-width: auto;
    border-radius: 4px;
  }
  & > .btn-next{
    margin-left: 5px;
    padding-left: 0;
    width: 28px;
    text-align: center;
    min-width: auto;
    border-radius: 4px;
  }
}
</style>
